/*
 * KBMain.java
 *
 * Created on __DATE__, __TIME__
 */

package com.kylinhunter.ch.plugin.knowledgebase.ui;

import java.beans.PropertyVetoException;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
 
import com.kylinhunter.ch.language.ResourceManager;
 
import com.kylinhunter.ui.common.DeskTopPanelInternalFrame;

/**
 *
 * @author  __USER__
 */
public class KownledgeBasePluginMainFrame extends DeskTopPanelInternalFrame  {
	private static final Log log = LogFactory.getLog(KownledgeBasePluginMainFrame.class);
	private KBMainPanel kbMainPanel = null;

	/** Creates new form KBMain */
	public KownledgeBasePluginMainFrame(String window_id, String title) {
		super(title, true, true, true, true);
		initComponents();
		this.setWindows_id(window_id);

	}

	/** Creates new form KBMain */
	public KownledgeBasePluginMainFrame() {
		initComponents();

	}

 

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	//GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		mainTabbedPane = new javax.swing.JTabbedPane();

		setClosable(true);
		setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
		setIconifiable(true);
		setMaximizable(true);
		setResizable(true);
		setTitle("knowledgebase");
		setPreferredSize(new java.awt.Dimension(400, 300));
		addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
			public void internalFrameActivated(
					javax.swing.event.InternalFrameEvent evt) {
				log.debug("internalFrameActivated");
			}

			public void internalFrameClosing(
					javax.swing.event.InternalFrameEvent evt) {
				formInternalFrameClosing(evt);
			}
			public void internalFrameClosed(
					javax.swing.event.InternalFrameEvent evt) {
				log.debug("internalFrameClosed");
			}

			

			public void internalFrameDeactivated(
					javax.swing.event.InternalFrameEvent evt) {
				log.debug("internalFrameDeactivated");
			}

			public void internalFrameDeiconified(
					javax.swing.event.InternalFrameEvent evt) {
				log.debug("internalFrameDeiconified");
			}

			public void internalFrameIconified(
					javax.swing.event.InternalFrameEvent evt) {
				log.debug("internalFrameIconified");
			}

			public void internalFrameOpened(
					javax.swing.event.InternalFrameEvent evt) 
			{
				log.debug("internalFrameOpened");
			}
		});
		getContentPane().add(mainTabbedPane, java.awt.BorderLayout.CENTER);

		pack();
	}// </editor-fold>
	//GEN-END:initComponents

	private void formInternalFrameClosing(
			javax.swing.event.InternalFrameEvent evt) {
		// TODO add your handling code here:
		log.debug("formInternalFrameClosing");
		//this.dispose();
		log.debug("formInternalFrameClosing");
	}

	//GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JTabbedPane mainTabbedPane;

	// End of variables declaration//GEN-END:variables
	public KBMainPanel getKbMainPanel() {
		return kbMainPanel;
	}

	public void setKbMainPanel(KBMainPanel kbMainPanel) {
		this.kbMainPanel = kbMainPanel;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		// TODO Auto-generated method stub
		this.mainTabbedPane.addTab("kbMainPanel", this.kbMainPanel);
		 
	}

 

	@Override
	public void updateResource(ResourceManager resourceManager) {
		// TODO Auto-generated method stub
		this.setTitle(resourceManager.getString(KownledgeBasePlugin.RESOURCE,"kbMain.title"));
		this.mainTabbedPane.setTitleAt(0, resourceManager
				.getString(KownledgeBasePlugin.RESOURCE,"kbMain.kbMainPanel.title"));

	}

	@Override
	public void chInit() {
		// TODO Auto-generated method stub
		this.kbMainPanel.chInit(); 
	}

}